<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Minim : : UGen.UGenInput</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body> 
<center>
<table class="mainTable">
  <tr>
    <td class="header">
    	<span class="indexheader">Minim</span><br/>
    	<span class="indexnavigation">
    		<a href="index.html">core</a> | 
    		<a href="index_ugens.html">ugens</a> | 
    		<a href="index_analysis.html">analysis</a>
    	</span>
    </td>
    <td class="border-left">&nbsp;</td>
  </tr>
  
  <tr>
    <td class="classNavigation">
    	<p class="mainTextName">UGen.UGenInput</p>
    	
    	
       <p class="linkListHeader">Methods</p>
       <p class="linkList">
           
    <a href="ugen.ugeninput_method_channelcount.html" title="Returns how many channels this UGenInput generates.">channelCount ( )</a><br/>
    
    <a href="ugen.ugeninput_method_getincomingugen.html" title="The incoming UGen is the UGen that is patched to 
 this UGenInput. When this input is ticked, it 
 will tick the incoming UGen and store the result
 in its last values.">getIncomingUGen ( )</a><br/>
    
    <a href="ugen.ugeninput_method_getinputtype.html" title="Returns the InputType of this UGenInput.">getInputType ( )</a><br/>
    
    <a href="ugen.ugeninput_method_getlastvalue.html" title="Returns the first value in the array of last values.">getLastValue ( )</a><br/>
    
    <a href="ugen.ugeninput_method_getlastvalues.html" title="Access the last values generated by this input.">getLastValues ( )</a><br/>
    
    <a href="ugen.ugeninput_method_getouterugen.html" title="The outer UGen is the UGen that owns this input.
 For instance, calling this on the frequency UGenInput
 member of an Oscil will return the Oscil.">getOuterUGen ( )</a><br/>
    
    <a href="ugen.ugeninput_method_ispatched.html" title="Returns true if a UGen is patched to this UGenInput.">isPatched ( )</a><br/>
    
    <a href="ugen.ugeninput_method_printinput.html" title="Print information about this UGenInput (for debugging)">printInput ( )</a><br/>
    
    <a href="ugen.ugeninput_method_setchannelcount.html" title="Set the number of channels this input should generate.
 This will be called by the owning UGen if this input 
 is an AUDIO input.">setChannelCount ( )</a><br/>
    
    <a href="ugen.ugeninput_method_setincomingugen.html" title="This method is called when a UGen is patched to this input.
 Typically you will not call this method directly, 
 use UGen's patch method instead.">setIncomingUGen ( )</a><br/>
    
    <a href="ugen.ugeninput_method_setlastvalue.html" title="Sets all values in the last values array to the provided value.">setLastValue ( )</a><br/>
    
	   </p>
   
    </td>
    <td class="mainText border-left">
    	A UGenInput represents parameter of the UGen that can be 
 controlled by other UGens by patching to it. When not patched,
 a UGenInput produces a constant value, which can be changed at 
 any time by calling setLastValue.
 <p>
 A UGenInput will have an InputType of either AUDIO or CONTROL.
 An AUDIO input will always have the same number of channels 
 as the owning UGen, in other words the length of the array 
 returned by getLastValues will have a length equal to 
 channel count. A CONTROL input will always have one channel 
 and its value can be conveniently queried by calling getLastValue().
    	<p class="memberSectionHeader">Constructors</p>
    	<pre><em>Create a UGenInput with a particular type.</em>
UGenInput(UGen.InputType type)
<em>Create a UGenInput of the specified type with an initial value.</em>
UGenInput(UGen.InputType type, float value)
</pre>
    	
   <p class="memberSectionHeader">Parameters</p>
   
        <span class="parameterName">type</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">the InputType of this UGenInput</span><br/>
    
        <span class="parameterName">value</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">the initial float value used for all last values</span><br/>
    
   
    	<p class="memberSectionHeader">Related</p>
    	
    	<p class="memberSectionHeader">Example</p>
    	<pre>/**
  * This sketch demonstrates how to create a simple synthesis chain that 
  * involves controlling the value of a UGenInput with the output of 
  * a UGen. In this case, we patch an Oscil generating a sine wave into 
  * the amplitude input of an Oscil generating a square wave. The result 
  * is known as amplitude modulation.
  * &lt;p>
  * For more information about Minim and additional features, 
  * visit http://code.compartmental.net/minim/
  */

import ddf.minim.*;
import ddf.minim.ugens.*;

Minim minim;
AudioOutput out;
Oscil       wave;
Oscil       mod;

void setup()
{
  size(512, 200, P3D);
  
  minim = new Minim(this);
  
  // use the getLineOut method of the Minim object to get an AudioOutput object
  out = minim.getLineOut();
  
  // create a triangle wave Oscil, set to 440 Hz, at 1.0 amplitude
  // in this case, the amplitude we construct the Oscil with 
  // doesn't matter because we will be patching something to
  // its amplitude input.
  wave = new Oscil( 440, 1.0f, Waves.TRIANGLE );
 
  // create a sine wave Oscil for modulating the amplitude of wave
  mod  = new Oscil( 2, 0.4f, Waves.SINE );
 
  // connect up the modulator
  mod.patch( wave.amplitude );
  
  // patch wave to the output
  wave.patch( out );
}

void draw()
{
  background(0);
  stroke(255);
  
  // draw the waveforms
  for(int i = 0; i &lt; out.bufferSize() - 1; i++)
  {
    line( i, 50 + out.left.get(i)*50, i+1, 50 + out.left.get(i+1)*50 );
    line( i, 150 + out.right.get(i)*50, i+1, 150 + out.right.get(i+1)*50 );
  }
}
</pre>
    	<p class="memberSectionHeader">Usage</p>
    	Web & Application
    </td>
  </tr>
</table>
</center>
</body>
</html>